import redis   # 导入redis 模块

r = redis.Redis(host='localhost', port=6379, decode_responses=True)
r.set('name-test', 'runoob')  # 设置 name 对应的值
print(r['name-test'])
print(r.get('name-test'))  # 取出键 name 对应的值
print(type(r.get('name-test')))  # 查看类型

# key art_tasks_total_count_ + 任务id
r.set('art_tasks_total_count_5efb173eeab4582d2b501995', '1')  # 设置 name 对应的值
print(r['art_tasks_total_count_5efb173eeab4582d2b501995'])
print(r.get('art_tasks_total_count_5efb173eeab4582d2b501995'))  # 取出键 name 对应的值
print(type(r.get('art_tasks_total_count_5efb173eeab4582d2b501995')))  # 查看类型